#ifndef UTILITIES2008
#define UTILITIES2008

#define PI  3.1415926535897932384626433832795
#define PI2 1.5707963267948966192313216916398
#define PI4 0.78539816339744830961566084581988

#include "../GL/glut.h"
#include "../mtxlib/mtxlib.h"



#define min($x, $y) (($x < $y) ? ($x) : ($y))



template <typename T> class Singleton
{
protected:

	static T* ms_Singleton;

public:
	Singleton( void )
	{
		ms_Singleton = static_cast< T* >( this );
	}
	~Singleton( void )
	{ 
		ms_Singleton = 0;  
	}
	static T& getSingleton( void )
	{ 
		return ( *ms_Singleton ); 
	}
	static T* getSingletonPtr( void )
	{ 
		return ms_Singleton; 
	}
};

struct GlobalUtils{
	GLUquadricObj *quadratic;
};

extern GlobalUtils  globalUtils;

void DisplayFrameWF();
void DisplayFrameWF(mtxlib::matrix44 &mat);
void DisplayFrame();
void DisplayFrame(float red, float green, float blue);
void DisplayDegFrame();

void DrawBox();

void DrawGrid(float startX, float endX, float startZ, float endZ, float step);
int ReadJpg(const char *filename, int *width, int *height, unsigned char **pixels, int *components);


#endif 